namespace System.Net.DnsToolkit.Packet {
    /// <summary>
    /// 
    /// 4.1.1. Header section format<br/>
    /// The header contains the following fields:<br/>
    /// <pre>
    ///                                     1  1  1  1  1  1<br/>
    ///       0  1  2  3  4  5  6  7  8  9  0  1  2  3  4  5<br/>
    ///     +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+<br/>
    ///     |                      Id                       |<br/>
    ///     +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+<br/>
    ///     |QR|   Opcode  |AA|TC|RD|RA|ZZ|AU|AO|   RCODE   |<br/>
    ///     +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+<br/>
    ///     |                    QDCOUNT                    |<br/>
    ///     +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+<br/>
    ///     |                    ANCOUNT                    |<br/>
    ///     +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+<br/>
    ///     |                    NSCOUNT                    |<br/>
    ///     +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+<br/>
    ///     |                    ARCOUNT                    |<br/>
    ///     +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+<br/>
    /// </pre>
    /// </summary>
    public interface IHeader {
                
        /// <summary>
        /// A 16 bit identifier assigned by the program that
        /// generates any kind of query.  This identifier is copied
        /// the corresponding reply and can be used by the requester
        /// to match up replies to outstanding queries.
        /// </summary>
        ushort Id { get; set; }
        /// <summary>
        /// QR - A one bit field that specifies whether this message is a
        /// query (0), or a response (1).
        /// </summary>
        QREnum QueryType { get; set; }
        /// <summary>
        /// A four bit field that specifies kind of query in this
        /// message.  This value is set by the originator of a query
        /// and copied into the response. 
        /// </summary>
        OpCodeEnum OpCode { get; set; }
        /// <summary>
        /// AA - Authoritative Answer - this bit is valid in responses,
        /// and specifies that the responding name server is an
        /// authority for the domain name in question section
        /// 
        /// Note that the contents of the answer section may have
        /// multiple owner names because of aliases.  The AA bit
        /// 
        /// corresponds to the name which matches the query name, or
        /// the first owner name in the answer section.
        /// </summary>
        bool AuthoritativeAnswer { get; set; }
        /// <summary>
        /// TC - TrunCation - specifies that this message was truncated
        /// due to length greater than that permitted on the
        /// transmission channel.
        /// </summary>
        bool Truncation { get; set; }
        /// <summary>
        /// RD - Recursion Desired - this bit may be set in a query and
        /// is copied into the response.  If RD is set, it directs
        /// the name server to pursue the query recursively.
        /// Recursive query support is optional.
        /// </summary>
        bool RecursionDesired { get; set; }
        /// <summary>
        /// RA - Recursion Available - this be is set or cleared in a
        /// response, and denotes whether recursive query support is
        /// available in the name server.
        /// </summary>
        bool RecursionAvailable { get; set; }
        /// <summary>
        /// Z - Reserved for future use.  Must be zero in all queries
        /// and responses.
        /// </summary>
        bool Reserved { get; set; }
        bool AnswerAuthenticated { get; set; }
        bool NotAuthenticatedAcceptable { get; set; }
        /// <summary>
        /// RESPONSE code - this 4 bit field is set as part of
        /// responses.  The values have the following
        /// interpretation:
        /// </summary>
        RCodeEnum ResponseCode { get; set; }
        /// <summary>
        /// an unsigned 16 bit integer specifying the number of
        /// entries in the question section.
        /// </summary>
        ushort QuestionCount { get; set; }
        /// <summary>
        /// an unsigned 16 bit integer specifying the number of
        /// resource records in the answer section.
        /// </summary>
        ushort AnswerCount { get; set; }
        /// <summary>
        /// an unsigned 16 bit integer specifying the number of name
        /// server resource records in the authority records
        /// section.
        /// </summary>
        ushort AuthorityCount { get; set; }
        /// <summary>
        /// an unsigned 16 bit integer specifying the number of
        /// resource records in the additional records section.
        /// </summary>
        ushort ResourceCount { get; set; }
    }
}
